package br.uece.comp.heap.binomial;

import br.uece.comp.heap.HeapNode;

public class BinomialNode<Type> implements HeapNode<Type> {

	private Type datum;

	private int degree;

	private BinomialNode<Type> child;

	private BinomialNode<Type> sibling;

	private BinomialNode<Type> father;

	public BinomialNode(Type datum) throws IllegalArgumentException {
		// if (data instanceof Comparable<Type>) {
		this.datum = datum;
		this.degree = 0;
		// }
	}

	public Type getDatum() {
		return datum;
	}

	public int getDegree() {
		return degree;
	}

	public BinomialNode<Type> getChild() {
		return child;
	}

	public BinomialNode<Type> getSibling() {
		return sibling;
	}

	public BinomialNode<Type> getFather() {
		return father;
	}

	public void setDatum(Type datum) {
		this.datum = datum;
	}

	public void increaseDegree() {
		this.degree++;
	}

	public void decreaseDegree() {
		this.degree--;
	}

	public void setChild(BinomialNode<Type> child) {
		this.child = child;
	}

	public void setSibling(BinomialNode<Type> sibling) {
		this.sibling = sibling;
	}

	public void setFather(BinomialNode<Type> father) {
		this.father = father;
	}

	@SuppressWarnings("unchecked")
	@Override
	public int compareTo(HeapNode<Type> another) {
		return ((Comparable<Type>) datum).compareTo(another.getDatum());
	}
}